define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
    var Controller = {
        index : function () {
            new Vue({
                el: "#containerBox",
                data() {
                    return {
                        orderList: [],
                        // form搜索
                        searchForm    : {
                            create_time: [],

                        },
                        searchFormInit: {
                            create_time: [],
                        },
                        //表格分页参数
                        paginate: {
                            page      : 1,
                            limit     : 10,
                            total_page: 1,
                            total     : 0,
                        }
                    }
                },
                mounted() {
                    this.reqOrderList()
                },
                methods: {
                    //请求
                    reqOrderList(offset, limit) {
                        let that = this;
                        let filter = {
                            page : that.paginate.page,
                            limit: that.paginate.limit,
                        }
                        // return false;
                        Fast.api.ajax({
                            url    : 'health/order/fulu_order/index',
                            loading: true,
                            type   : 'GET',
                            data   : filter
                        }, function (ret, res) {
                            that.orderList = res.data.rows;
                            that.paginate.total = res.data.total;
                            that.paginate.total_page = res.data.total_page
                            return false;
                        })
                    },
                    operation(type, id) {
                        let that = this;
                        switch (type) {
                            case 'user_profile':
                                Fast.api.open('health/user/user/profile?id=' + id, '用户详情', {
                                    callback() {
                                        // that.reqOrderList();
                                    }
                                })
                                break;
                            case 'detail'://详情
                                Fast.api.open('health/order/fulu_order/detail?id=' + id, '订单详情', {
                                    callback() {
                                        // that.reqOrderList();
                                    }
                                })
                                break;
                        }
                    },
                    handleSizeChange(val) {
                        this.paginate.limit = val
                        this.paginate.page = 1;
                        this.reqOrderList()
                    },
                    handleCurrentChange(val) {
                        this.paginate.page = 1;
                        this.reqOrderList()
                    },
                },
                watch  : {}
            })
        },
        detail: function () {
            new Vue({
                el: "#detail",
                data() {
                    return {
                        data: {},
                    }
                },
                created() {
                    this.data = JSON.parse(JSON.stringify(Config.row));
                },
                methods: {},
            })
        }
    }
    return Controller;
});